

var echarts_config = function(){
	// 路径配置
	require.config({
	    paths: {
	        echarts: 'http://echarts.baidu.com/build/dist'
	    }
	});
}

var echarts_use = function(option,toID){
	// 使用
	require(
	    [
	        'echarts',
	        'echarts/chart/pie', // 使用柱状图就加载bar模块，按需加载
	    	'echarts/chart/line',
	    	
	    ],
	    function (ec) {
	    
	        // 基于准备好的dom，初始化echarts图表
	        var myChart = ec.init(document.getElementById(toID)); 
	        
	
	        // 为echarts对象加载数据 
	        myChart.setOption(option); 
	    }
	);
}





option = {
    title : {
        text: '热门媒体',
        subtext: '热门媒体分布图',
        x:'center'
    },
    tooltip : {
        trigger: 'item', //触发类型，默认数据触发 (可选为：'item' | 'axis')
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient : 'vertical',
        x : 'left',
        data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
    },
    toolbox: {
        show : true,
        feature : {
//          mark : {show: true},
//          dataView : {show: true, readOnly: false},
//          magicType : {
//              show: true, 
//              type: ['pie', 'funnel'],
//              option: {
//                  funnel: {
//                      x: '25%',
//                      width: '50%',
//                      funnelAlign: 'left',
//                      max: 1548
//                  }
//              }
//          },
//          restore : {show: true,title:''},
//          saveAsImage : {show: true,title:''}
        }
    },
//  calculable : true,
    series : [
        {
            name:'访问来源',
            type:'pie',
            radius : '55%',
            center: ['50%', '60%'],
            data:[
                {value:335, name:'直接访问'},
                {value:310, name:'邮件营销'},
                {value:234, name:'联盟广告'},
                {value:135, name:'视频广告'},
                {value:1548, name:'搜索引擎'}
            ],
            selectedMode:'single',
            selectedOffset:10
        }
    ]
};
                    


fmyq_option = {
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
    },
    toolbox: {
        show : true,
        feature : {
//          mark : {show: true},
//          dataView : {show: true, readOnly: false},
//          magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
//          restore : {show: true},
//          saveAsImage : {show: true}
        }
    },
//  calculable : true,
    xAxis : [
        {
            type : 'category',
            boundaryGap : false,
            data : ['周一','周二','周三','周四','周五','周六','周日']
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name:'邮件营销',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[120, 132, 101, 134, 90, 230, 210]
        },
        {
            name:'联盟广告',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[220, 182, 191, 234, 290, 330, 210]
        },
        {
            name:'视频广告',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[150, 232, 201, 154, 190, 330, 410]
        },
        {
            name:'直接访问',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[320, 332, 301, 334, 390, 330, 320]
        },
        {
            name:'搜索引擎',
            type:'line',
            stack: '总量',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[820, 932, 901, 934, 1290, 1330, 1320]
        }
    ]
};
                    
